package com.lyf.boot.modules.user.controller;

import com.lyf.boot.modules.user.entity.UserExcel;
import com.lyf.boot.utils.ServerUtil;
import com.lyf.boot.utils.poi.ExcelUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

/**
 * 用户接口
 * @author Luyufan
 * @date 2023/8/15 10:19
 */
@RestController
@RequestMapping("/user")
@RequiredArgsConstructor
public class UserController {

    /**
     * 用户导出
     */
    @PostMapping("/exportUser")
    public void exportUser(){
        List<UserExcel> userExcels = new ArrayList<>();
        UserExcel u1 = new UserExcel();
        u1.setUsername("凡繁烦");
        u1.setAddress("武汉市");
        u1.setBirthday(LocalDate.now());
        u1.setRealName("卢玉凡");
        u1.setStatus(1);
        u1.setGender("1");
        userExcels.add(u1);
        ExcelUtil.exportExcel(userExcels,"用户", UserExcel.class, ServerUtil.response());
    }
}
